package controller

import (
	"dujitang/src/service"
	"log"

	"github.com/kataras/iris/v12"
)

// Index is 毒鸡汤 页面
func Index(ctx iris.Context) {
	result, err := service.Index()

	if err != nil {
		log.Fatal(err)
	}
	ctx.ViewData("title", "Home page")
	ctx.ViewData("body", result)
	ctx.View("index.html")
}

// Chicken is 毒鸡汤 接口
func Chicken(ctx iris.Context) {
	result, err := service.Index()

	if err != nil {
		log.Fatal(err)
	}
	ctx.JSON(result)
}
